﻿package tk.mystudio.permission.bean;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 资源类
 * @author jiangkunpeng
 * @since 2011-3-16 
 * @version 1.0
 */
@Entity
@Table(name = "resource")
public class Resource implements Serializable {

	private static final long serialVersionUID = -4153991218499571294L;

	/**
	 * 资源编号
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", columnDefinition = "int")
	protected Integer id;
	
	/**
	 * 父节点编号
	 */
	@Column(name = "parent_id", columnDefinition = "int")
	protected Integer parentId;
	
	/**
	 * 资源名称
	 */
	@Column(name = "name", columnDefinition = "varchar(20)")
	protected String name;
	
	/**
	 * 资源类型
	 */
	@Column(name = "type", columnDefinition = "tinyint")
	protected Integer type;
	
	/**
	 * 资源路径
	 */
	@Column(name = "url", columnDefinition = "varchar(60)")
	protected String url;
	
	/**
	 * 显示顺序
	 */
	@Column(name = "display_order", columnDefinition = "smallint")
	protected Integer displayOrder;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getParentId() {
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}
	
	public Integer getDisplayOrder() {
		return displayOrder;
	}
	
	public void setDisplayOrder(Integer displayOrder) {
		this.displayOrder = displayOrder;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Resource [id=");
		builder.append(id);
		builder.append(", parentId=");
		builder.append(parentId);
		builder.append(", name=");
		builder.append(name);
		builder.append(", type=");
		builder.append(type);
		builder.append(", url=");
		builder.append(url);
		builder.append(", displayOrder=");
		builder.append(displayOrder);
		builder.append("]");
		return builder.toString();
	}
	
}
